load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "kv",
    srcs = [
        "admission.go",
        "batch.go",
        "db.go",
        "doc.go",
        "mock_transactional_sender.go",
        "range_lookup.go",
        "sender.go",
        "test_utils.go",
        "txn.go",
        "util.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/keys",
        "//pkg/kv/kvbase",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver/closedts",
        "//pkg/kv/kvserver/concurrency/isolation",
        "//pkg/roachpb",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql/sessiondatapb",
        "//pkg/storage/enginepb",
        "//pkg/testutils",
        "//pkg/util/admission",
        "//pkg/util/admission/admissionpb",
        "//pkg/util/duration",
        "//pkg/util/errorutil/unimplemented",
        "//pkg/util/hlc",
        "//pkg/util/log",
        "//pkg/util/protoutil",
        "//pkg/util/retry",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/tracing",
        "//pkg/util/tracing/tracingpb",
        "//pkg/util/uuid",
        "@com_github_cockroachdb_apd_v3//:apd",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
    ],
)

go_test(
    name = "kv_test",
    size = "medium",
    srcs = [
        "admission_test.go",
        "client_test.go",
        "db_test.go",
        "main_test.go",
        "range_lookup_test.go",
        "txn_external_test.go",
        "txn_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":kv"],
    shard_count = 16,
    deps = [
        "//pkg/base",
        "//pkg/config/zonepb",
        "//pkg/keys",
        "//pkg/kv/kvclient/kvcoord",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver",
        "//pkg/kv/kvserver/concurrency/isolation",
        "//pkg/kv/kvserver/concurrency/lock",
        "//pkg/kv/kvserver/kvserverbase",
        "//pkg/kv/kvserver/liveness/livenesspb",
        "//pkg/roachpb",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/security/username",
        "//pkg/server",
        "//pkg/settings/cluster",
        "//pkg/sql/sessiondatapb",
        "//pkg/storage/enginepb",
        "//pkg/testutils",
        "//pkg/testutils/kvclientutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/skip",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/util/admission/admissionpb",
        "//pkg/util/encoding",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/tracing",
        "//pkg/util/tracing/tracingpb",
        "//pkg/util/uuid",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_gogo_protobuf//proto",
        "@com_github_stretchr_testify//require",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//status",
        "@org_golang_x_sync//errgroup",
    ],
)
